Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Fractal analytic' - 1 question(s) found - Order By Newest | ||||
| ||||
Ans. There are total six ways 1. literals When we create a String using double quotes, JVM looks in the String pool to find if any other String is stored with same value. If found, it just returns the reference to that String object else it creates a new String object with given value and stores it in the String pool. 2. new keyword When we use new operator, JVM creates the String object but dont store it into the String Pool. We can use intern() method to store the String object into String pool or return the reference if there is already a String with equal value present in the pool. 3. string buffer 4. string builder 5. System.out.println 6. char to string | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   string class   string   jvm   memory management   string pool Asked in 5 Companies basic   frequent | ||||
Try 3 Question(s) Test | ||||
Related Questions | ||||
Does garbage collection guarantee that a program will not run out of memory? | ||||
Describe, in general, how java's garbage collector works ? | ||||
Describe what happens when an object is created in Java ? | ||||
What are various types of Class loaders used by JVM ? | ||||
Why two types of memory - stack and heap are required by Java ? | ||||
Should we override finalize method ? | ||||
What are strong, soft, weak and phantom references in Java ? | ||||
Which memory areas does instance and static variables use ? | ||||
Can we call the garbage collector explicitly ? | ||||